package net.domor.stock.sys.entity;

import com.google.common.collect.Lists;
import net.domor.stock.core.entity.Entity;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.List;

/**
 * Created by wgc on 2016/9/28.
 */
public class Menu extends Entity {

    private Integer id;

    private String name;

    private String url;

    private String icon;

    private Integer level = 0;

    private List<Menu> children = Lists.newArrayList();

    public Menu() {}

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public List<Menu> getChildren() {
        return children;
    }

    public void setChildren(List<Menu> children) {
        this.children = children;
    }

    public boolean hasChildren() {
        if (children == null) {
            return false;
        }
        if (children.size() == 0) {
            return false;
        }
        return true;
    }
}
